<script src="/login/status"></script>
<script>
    if(!isLogin) location.href = "/admin/login.html"
</script>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理后台首页</title>
    <link rel="stylesheet" href="../assets/vendors/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../assets/css/common.css">
    <link rel="stylesheet" href="../assets/css/admin.css">
    <link rel="stylesheet" href="../assets/vendors/aliFont/iconfont.css">
    <link rel="stylesheet" href="../assets/vendors/nprogress/nprogress.css">
    <script src="../assets/vendors/nprogress/nprogress.js"></script>
    <script src="../assets/vendors/Jquery/jquery-1.11.0.min.js"></script>
</head>
<body>
    <script>NProgress.start()</script>
    <div class="indexBox clearfix">
        <div class="slide">
            <div class="slide-head">
                <div class="avatar">
                    <img src="../uploads/avatar.jpg" alt="">
                </div>
                <span class="user">Coder</span>
            </div>
            <div class="nav">
                <ul class="navItems">
                    <li class="navActive">
                        <a href="./index.html">
                             <span class=" iconfont icon-yibiaopan"></span>仪表盘
                        </a>
                    </li>
                    <li>
                            <a href="javascript:;"><span class=" iconfont icon-wenzhang"></span>文章<span class=" iconfont icon-arrow-right arrow"></span></a>
                       
                        <ul class="itemgroup">
                            <li><a href="articleAll.html">所有文章</a></li>
                            <li><a href="addArticle.html">写文章</a></li>
                            <li><a href="cateArticle.html">分类目录</a></li>
                        </ul>
                    </li>
                    <li><a href="./comments.html"><span class=" iconfont icon-chat"></span>评论</a></li>
                    <li><a href="./user.html"><span class=" iconfont icon-yonghu"></span>用户</a></li>
                    <li>
                        
                           <a> <span class=" iconfont icon-shezhi"></span>设置<span class="iconfont icon-arrow-right arrow"></span></a>
                        <ul class="itemgroup" >
                            <li><a href="slides.html">图片轮播</a></li>
                            <li><a href="settings.html">网站设置</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <div class="main">
            <div class="content-head">
                <div class="content-icon">
                    <div class="content-left">
                        <span class="iconfont icon-shouqianniuicon"></span>
                    </div>
                </div>
                <div class="modify">
                  <a href="passwordReset.html">
                    <span class="iconfont icon-yonghu1"></span>修改密码
                  </a>
              </div>
                <div class="loginOut">
                    <span class="iconfont icon-tuichu_huaban1"></span><span>退出</span>
                </div>
            </div>
            <div class="content">
               <p>写文章</p>
              <div class="FormBox">
                <form action="" id="postsForm" class="row">
                
                  <div class="col-md-9">
                      <div class="art-formgroup">
                        <label for="">标题</label>
                        <input type="text" placeholder="文章标题" name="title" id="postTitle">
                      </div>
                      <div class="art-formgroup">
                        <label for="">内容</label>
                        <textarea type="text" placeholder="文章内容" name="content" id="postContent"></textarea>
                      </div>
                  </div>
                  <div class="col-md-3">
                    <div class="input-formgroup">
                      <label for="">文章封面</label>
                      <input type="file" id="postImg" >
                      <input type="hidden" name="thumbnail" id="postImgHidden">
                    </div>
                    <div class="input-formgroup">
                      <label for="">所属分类</label>
                      <select id="showcategory" name="category">
                        
                      </select>
                    </div>
                    <div class="input-formgroup">
                      <label for="">发布时间</label>
                      <input type="date" name="createAt" id="datePost">
                    </div>
                    <div class="input-formgroup">
                      <label for="">状态</label>
                      <select  id="postState" name="state">
                        <option value="0">草稿</option>
                        <option value="1">已发布</option>
                      </select>
                    </div>
                    <button type="submit" class="btn btn-primary active saveForm">保存</button>
                  </div>
             
              </form>
              </div>
          </div>
    </div>
    <script>NProgress.done()</script>
    <script src="../assets/js/common.js"></script>
    <script src="../assets/vendors/art-template/template-web.js"></script>
    <script type="text/html" id="showPostCateTpl">
      {{each data}}
      <option value="{{$value._id}}">{{$value.title}}</option>
      {{/each}}
    </script>
    <!-- 编辑修改模板 -->
    <script type='text/html' id="modifyPostTpl">
      <form action="" id="ModifypostsForm" class="row"  data-id="{{_id}}">
      <div class="col-md-9">
        <div class="art-formgroup">
          <label for="">标题</label>
          <input type="text" placeholder="文章标题" name="title" id="postTitle" value="{{title}}">
        </div>
        <div class="art-formgroup">
          <label for="">内容</label>
          <textarea type="text" placeholder="文章内容" name="content" id="postContent">{{content}}</textarea>
        </div>
    </div>
    <div class="col-md-3">
      <div class="input-formgroup">
        <label for="">文章封面</label>
        <input type="file" id="postImg" >
        <input type="hidden" name="thumbnail" id="postImgHidden" value="{{thumbnail}}">
      </div>
      <div class="input-formgroup">
        <label for="">所属分类</label>
        <select id="showcategory" name="category">
         {{each categories}}
          <option value="{{$value._id}}" {{$value._id == category._id? 'selected': ''}}>{{$value.title}}</option>
          {{/each}}
        </select>
      </div>
      <div class="input-formgroup">
        <label for="">发布时间</label>
        <input type="date" name="createAt" id="datePost" value="{{createAt.split('T')[0]}}">
      </div>
      <div class="input-formgroup">
        <label for="">状态</label>
        <select  id="postState" name="state">
          <option value="0" {{state == 0? 'selected': ''}}>草稿</option>
          <option value="1" {{state == 1? 'selected': ''}}>已发布</option>
        </select>
      </div>
      <button type="submit" class="btn btn-primary active">保存</button>
    </div>
  </form>
    </script>
    <script src="../assets/js/addPost.js"></script>
    
</body>
</html>